﻿// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

using System;
using FreshMeat.ErrorHandlingBlock;

namespace ErrorHandlingBlock.Tests
{
   public class FakeRetryPlan : IRetryPlan
   {
      readonly int maxAttempts;

      public FakeRetryPlan(int maxAttempts)
      {
         this.maxAttempts = maxAttempts;
      }

      public int MaxAttempts
      {
         get { return maxAttempts; }
      }

      public bool ShouldRetry(int attempts)
      {
         return attempts < MaxAttempts;
      }

      public TimeSpan GetTimeUntilNextAttempt(int attempts)
      {
         return TimeSpan.FromTicks(123);
      }
   }
}